<?php
require_once($application_folder."/controllers/navigator.php");
class Core extends navigator 
{

    function __construct()
    {
        parent::__construct(); 
    }

    function index(){ 

        /*Simle Log*/
        $this->firephp->log('Log message');

        /*Array*/
        $array = array('t1' => 10,'t2' => 20,'t3' => 30,);
        $this->firephp->log($array, "dumping an array");

        /*Info*/
        $this->firephp->info("information");

        /*Error*/
        $this->firephp->error("error message");

    }

    function print_all_posts(){

        print('<pre>');
        print_r($_POST);
        print('</pre>');

    } 

    function unit_testing(){

        $this->load->library('unit_test');

        /*$this->unit->run( test, expected result, 'test name', 'notes');*/

        $test = 1 + 1;

        $expected_result = 2;

        $test_name = 'Adds one plus one';

        $notes = 'Exaple of unit tesing in Code Igniter';

        echo $this->unit->run($test, $expected_result, $test_name, $notes);

    }

    function add(){

    }

    function edit(){

    }

    function delete(){

    }

    function view(){
             
    }

    function mediaeditor(){

        $this->load->helper('directory');

        $dir_url_img = './assets/mediagallery/img/';
        $dir_url_videos = './assets/mediagallery/videos/';

        $data['arr_img'] = directory_map($dir_url_img);
        $data['arr_videos'] = directory_map($dir_url_videos);

        $html = $this->load->view('mediaeditor', $data, TRUE);
        echo json_encode(array('html' => $html));

        //$this->navigate('mediaeditor',$data);

    }

    function jointest(){
        $this->load->model('articlem','art');
        //$res = $this->art->list_own();
        $res = $this->art->art_id(8);

        foreach ($res as $rrow){

            foreach ($rrow as $key => $value){

                echo $key.': '.$value.'<br />-------------------------------------------------------<br />';

            }
            echo '<br /><br />';

        }

    }

}